﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZWZ.Web.WebAdmin.Update
{
    public partial class MsgSend2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string MessageBody = Request.Form["myContent"];
            var umsg = new ModelBase.User_Message()
            {
                ID = Codes.IDHelper.CreateID_UserMessage(),
                SenderID = Codes.LoginHelper.CurrentUser.ID,
                SenderName = Codes.LoginHelper.CurrentUser.NickName,
                ReciverID = SelUsers1.SelectedUserID,
                ReciverName = SelUsers1.SelectedUserName,
                Title = hidTitle.Value,
                Body = MessageBody,
                CreateTime = DateTime.Now,
                SentTime = DateTime.Now,
                Status = ZWZ.Enums.User.MessageStatus.已发送未读.ToString(),
                Type = ZWZ.Enums.User.MessageType.私信.ToString(),
            };
            DBProvider.DB.Ctx.User_Message.AddObject(umsg);
            DBProvider.DB.Ctx.SaveChanges();
            new Codes.MessageBox(this).JavaScript("backToList();").Send();
        }
    }
}